package cn.stylefeng.guns.modular.gridsystem.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.gridsystem.service.BizGatewayNewFileService;
import cn.stylefeng.guns.modular.gridsystem.model.param.BizGatewayNewFileParam;

import javax.annotation.Resource;

/**
 * 网关最新文件 控制器
 *
 * @author: ssy
 * @date: 2022/11/03 15:47
 */
@RestController
public class BizGatewayNewFileController {

    @Resource
    private BizGatewayNewFileService bizGatewayNewFileService;

    /**
     * 分页查询网关最新文件
     *
     * @author ssy
     * @date 2022/11/03 15:47
     */
    @GetMapping("/bizGatewayNewFile/page")
    @BusinessLog(title = "网关最新文件_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(BizGatewayNewFileParam bizGatewayNewFileParam) {
        return new SuccessResponseData(bizGatewayNewFileService.pageList(bizGatewayNewFileParam));
    }

    /**
     * 获取全部网关最新文件
     *
     * @author ssy
     * @date 2022/11/03 15:47
     */
    @GetMapping("/bizGatewayNewFile/list")
    @BusinessLog(title = "网关最新文件_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list( ) {
        return new SuccessResponseData(bizGatewayNewFileService.list());
    }

    /**
     * 查看详情网关最新文件
     *
     * @author ssy
     * @date 2022/11/03 15:47
     */
    @GetMapping("/bizGatewayNewFile/detail")
    @BusinessLog(title = "网关最新文件_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(BizGatewayNewFileParam.detail.class) BizGatewayNewFileParam bizGatewayNewFileParam) {
        return new SuccessResponseData(bizGatewayNewFileService.detail(bizGatewayNewFileParam));
    }

    /**
     * 添加网关最新文件
     *
     * @author ssy
     * @date 2022/11/03 15:47
     */
    @PostMapping("/bizGatewayNewFile/add")
    @BusinessLog(title = "网关最新文件_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(BizGatewayNewFileParam.add.class) BizGatewayNewFileParam bizGatewayNewFileParam) {
        bizGatewayNewFileService.add(bizGatewayNewFileParam);
        return new SuccessResponseData();
    }

    /**
     * 删除网关最新文件
     *
     * @author ssy
     * @date 2022/11/03 15:47
     */
    @PostMapping("/bizGatewayNewFile/delete")
    @BusinessLog(title = "网关最新文件_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(BizGatewayNewFileParam.delete.class) BizGatewayNewFileParam bizGatewayNewFileParam) {
        bizGatewayNewFileService.delete(bizGatewayNewFileParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑网关最新文件
     *
     * @author ssy
     * @date 2022/11/03 15:47
     */
    @PostMapping("/bizGatewayNewFile/edit")
    @BusinessLog(title = "网关最新文件_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(BizGatewayNewFileParam.edit.class) BizGatewayNewFileParam bizGatewayNewFileParam) {
        bizGatewayNewFileService.edit(bizGatewayNewFileParam);
        return new SuccessResponseData();
    }


}
